package app.qrcode.browser.ykpixabay.logic.network

import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

/**
 * Created by YiGo on 2022/4/18.
 */
object ServiceCreator {

    private const val BASE_URL = "https://pixabay.com/api/"

    private val retrofit = Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .build()

    fun <T> create(ServiceClass: Class<T>): T = retrofit.create(ServiceClass)

    inline fun <reified T> create(): T = create(T::class.java)

}